//
//  ViewController.m
//  DEMO2
//
//  Created by J on 2016/12/3.
//  Copyright © 2016年 J. All rights reserved.
//

#import "ViewController.h"
#import "UIView+TKExtension.h"
#import "UIView+ShowInView.h"

#import <objc/runtime.h>
//#define TLog(_var) ({ NSString *name = @#_var; NSLog(@"%@: %@ -> %p : %@  %@", name, [_var class], _var, _var, @([_var retainCount])); })
#import "ACArticleSettingAlertView.h"
#import "UIView+Utilities.h"
@interface ViewController ()
@property(nonatomic,strong)ACArticleSettingAlertView *selections;
@end
#define makechar(x) @#x
@implementation ViewController
static char * isGoodFriendKey;
- (IBAction)button:(UIButton *)sender {
}

NSInteger i = 0;
static void tap(){
    
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    if([self.selections isShowing]) return;//如果正在显示 那么return
    [self.selections  showInContainerView:self.view targetTop:0];
    self.selections.didDismissFromContainerBlock = ^(){
        
    };
}

static NSArray *ACArticleFontTitles() {
    return @[ACArticleFontTitle(ACArticleSmallFont),ACArticleFontTitle(ACArticleNormalFont),ACArticleFontTitle(ACArticleLittleLargeFont),ACArticleFontTitle(ACArticleLargeFont)];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.selections = [ACArticleSettingAlertView new];
//    [self.view addSubview: selections];
    
    
    
    self.view.backgroundColor = [UIColor lightGrayColor];
//    NSLog(@"makechar class %@",[makechar(姜自佳) class]);
//    NSLog(@"makechar %@",makechar(姜自佳));
//    NSLog(@"makechar1111 %@",makechar(1111));
    
//    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];

//    NSLog(@"button:%@",button.backgroundColor);
    NSLog(@"backgroundColor:%@",_button.backgroundColor);
    
       objc_setAssociatedObject(self, isGoodFriendKey, @YES, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

    
        BOOL isGotoAddFriendView = [objc_getAssociatedObject(self, isGoodFriendKey) boolValue];
        
        NSLog(@"isGotoAddFriendView %zd",isGotoAddFriendView);
    
    
    NSString *str1 = @"sa";
//    TLog(str1);
    //str1: __NSCFConstantString -> 0x100001050 : sa  18446744073709551615
    NSString *str2 = [NSString stringWithString:@"sa"];
//    TLog(str2);
    //str2: __NSCFConstantString -> 0x100001050 : sa  18446744073709551615
    NSString *str3 = @"1234567890";
//    TLog(str3);
    
    NSString* str3MutableCopy = [str3 mutableCopy];
//    TLog(str3MutableCopy);
    //__NSCFString进行retain和mutableCopy操作时，其特性符合正常的对象特性。但是对其copy时，
    //它却变成了一个__NSCFConstantString对象！为了确定什么情况下才会出现这种现象我们多做一些测试
    
    //str3: __NSCFConstantString -> 0x100001110 : 1234567890  18446744073709551615
    NSString *str4 = [NSString stringWithFormat:@"sa"];
//    TLog(str4);
    //str4: NSTaggedPointerString -> 0x617325 : sa  18446744073709551615
    NSString *str5 = [NSString stringWithFormat:@"sa"];
//    TLog(str5);
    //str5: NSTaggedPointerString -> 0x617325 : sa  18446744073709551615
    NSString *str6 = [NSString stringWithFormat:@"123456789"];
//    TLog(str6);
    //str6: NSTaggedPointerString -> 0x1ea1f72bb30ab195 : 123456789  18446744073709551615
    NSString *str7 = [NSString stringWithFormat:@"1234567890"];
//    TLog(str7);
//    str7: __NSCFString -> 0x100300800 : 1234567890  1
    
    
//    dispatch_queue_t targetQueue = dispatch_queue_create("targetQueue", DISPATCH_QUEUE_SERIAL);//目标队列
//    dispatch_queue_t queue1 = dispatch_queue_create("queue1", DISPATCH_QUEUE_SERIAL);//串行队列
//    dispatch_queue_t queue2 = dispatch_queue_create("queue1", DISPATCH_QUEUE_CONCURRENT);//并发队列
//    //设置参考
//    dispatch_set_target_queue(queue1, targetQueue);
//    dispatch_set_target_queue(queue2, targetQueue);
//    
//    dispatch_async(queue2, ^{
//        NSLog(@"job3 in");
//        [NSThread sleepForTimeInterval:.1f];
//        NSLog(@"job3 out");
//    });
//    dispatch_async(queue2, ^{
//        NSLog(@"job2 in");
//        [NSThread sleepForTimeInterval:.2f];
//        NSLog(@"job2 out");
//    });
//    dispatch_async(queue1, ^{
//        NSLog(@"job1 in");
//        [NSThread sleepForTimeInterval:.3f];
//        NSLog(@"job1 out");
//    });
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (void)dealloc {
//    [_button release];
//    [super dealloc];
}
@end
